Skip to content

perf(project-onboard): read Phase 2 inputs from local FS when repo is checked out#28

Merged
joedanz merged 1 commit intomasterfrom
perf/project-onboard-local-reads
Apr 17, 2026
Merged

perf(project-onboard): read Phase 2 inputs from local FS when repo is checked out#28
joedanz merged 1 commit intomasterfrom
perf/project-onboard-local-reads

Conversation

@joedanz
Copy link
Copy Markdown
Owner

@joedanz joedanz commented Apr 17, 2026

Summary

  • Phase 2 of the project-onboard skill now reads README, dependency manifest, and root listing from the local filesystem when $PROJECT_ROOT is set, saving thousands of tokens per run on repos with sizable READMEs (avoids the base64+JSON envelope that gh api /contents/... wraps around every payload).
  • $PROJECT_ROOT is exported in Phase 0 Step 2 whenever the repo is available locally (cwd inference via git rev-parse --show-toplevel, or explicit local-path invocation resolved via realpath).
  • Remote-only invocation path (GitHub URL or <owner>/<name> from outside a checkout) is unchanged — it still uses gh api /contents/... for everything.
  • Single gh api repos/<owner>/<name> metadata call is retained for GitHub-only fields (description, topics, homepage, fork, parent, default_branch).
  • Conflict rule added: when local and remote disagree, trust local — the user is onboarding the state of their workspace, not main.

Test plan

  • bun test test/skills-conformance.test.ts passes (134/134)
  • Run project-onboard from inside pbrain and confirm Phase 0 idempotency gate short-circuits (already onboarded)
  • Run project-onboard in a fresh session from a not-yet-onboarded local repo; confirm README + manifest come from Read, root listing from Glob, and only one gh api repos/... call fires
  • Run project-onboard <owner>/<name> from a non-repo directory; confirm remote-only path still uses gh api for all four fetches

… checked out

Phase 2 was fetching README, dependency manifest, and root listing via
gh api even when the user was sitting inside the repo. Each /contents/
call base64-wraps its payload inside a JSON envelope — a 30 KB README
costs ~40 KB of tokens vs. raw bytes from Read.

Phase 0 Step 2 now exports $PROJECT_ROOT when the repo is available
locally (inferred from cwd, or supplied as a local path). Phase 2
branches on that signal: local reads via Read/Glob when set, gh api
/contents/... fallback when unset (GitHub URL / owner/name path).

The single gh api repos/<owner>/<name> metadata call is retained for
fields with no local analogue (description, topics, homepage, fork,
parent, default_branch).
@joedanz joedanz merged commit 2844058 into master Apr 17, 2026
3 checks passed
@joedanz joedanz deleted the perf/project-onboard-local-reads branch April 17, 2026 16:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant